/* ---------------------------------------------------------------------------------------------
 *
 *            Capital Alliance Software Confidential Proprietary
 *            (c) Copyright CAS 201{x}, All Rights Reserved
 *                          www.pekall.com
 *
 * ----------------------------------------------------------------------------------------------
 */

package com.android.music.adapter;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.android.music.R;
import com.android.music.util.MusicOperate;

public class GenresListAdapter extends BaseAdapter {
    private Cursor cursor;

    private Context mContext;

    public GenresListAdapter(Context context) {
        cursor = MusicOperate.getAudioGenres(context);
        mContext = context;
    }

    public int getCount() {
        if (cursor == null)
            return 0;
        return cursor.getCount();
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    private TextView genresname;

    public View getView(int position, View convertView, ViewGroup parent) {
        cursor.moveToPosition(position);
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.genresitem, null);
        }
        genresname = (TextView) convertView.findViewById(R.id.genresname);
        genresname.setText(cursor.getString(1));
        return convertView;
    }

}
